import { Radio } from 'antd'
import useLanguage from '@/hooks/useLang'
import { tranlateKeyMap } from '@/config/keyMap'

const WebLanguage = () => {
  const { changeLanguage, initLang } = useLanguage()
  const { LANG_ENUM } = tranlateKeyMap()
  return <Radio.Group defaultValue={initLang} buttonStyle="solid" onChange={e => changeLanguage(e.target.value)}>
    {
      LANG_ENUM.map(item => <Radio.Button key={item.code} value={item.code}>{item.title}</Radio.Button>)
    }
</Radio.Group>
}

export default WebLanguage
